package com.koron.operation.startlog.mapper;

import com.koron.operation.dispatch.bean.dto.UnitSynDto;
import com.koron.operation.startlog.bean.EqUnitDanageNameBo;
import com.koron.operation.startlog.bean.StartLogBean;
import com.koron.operation.startlog.bean.bo.EqSortBean;
import com.koron.operation.startlog.bean.dto.StartLogDto;
import com.koron.operation.startlog.bean.dto.StartOperDto;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface StartLogBeanMapper {
    int deleteInPrimaryKey(List<String> list);

    int insert(StartLogBean record);

    int insertSelective(StartLogBean record);

    StartLogBean selectByPrimaryKey(String id);

    int updateByPrimaryKeySelective(StartLogBean record);

    int updateByPrimaryKey(StartLogBean record);

    int batchInsert(@Param("list") List<StartLogBean> list);


    //机组开停机列表
    List<StartLogBean> queryAll(StartLogDto dto);

    //获取机组最新的操作记录
    StartLogBean queryFirstByEquipmentId(@Param("equipmentId") String equipmentId);

    //根据设备id 非废弃状态 获取机组最新的操作记录
    StartLogBean queryFirstByEquipmentIdFQ(@Param("equipmentId")String equipmentId);

    //开关机操作列表
    List<StartOperDto> queryList();

    List<EqSortBean> getSort(String eqType);

    //操作时间之后 且不等于本记录
    List<StartLogBean> queryAllByOperateTimeAfterAndEquipmentId(@Param("minOperateTime") Date minOperateTime, @Param("equipmentId") String equipmentId, @Param("id") String id);

    //操作时间之前 且不等于本记录
    List<StartLogBean> queryAllByOperateTimeBeforeAndEquipmentId(@Param("maxOperateTime") Date maxOperateTime, @Param("equipmentId") String equipmentId, @Param("id") String id);

    //获取机组最后同步时间
    List<UnitSynDto> getLastSynTime();

    //批量确认
    int updateIsConfirmByIdList(@Param("updatedIsConfirm") Integer updatedIsConfirm, @Param("list") List<String> list);

    //批量试机 同时确认
    int updateIsTestById(@Param("updatedIsTest") Boolean updatedIsTest, @Param("list") List<String> list);

    //申请批复
    int updateIsConfirmById(@Param("updatedIsConfirm") Integer updatedIsConfirm, @Param("id") String id);

    //批量检查确认的数据 有没有关机不成功的
    List<StartLogBean> queryAllInIdAndOperateType(@Param("list") List<String> list, @Param("operateType") String operateType);

    //查某机组 区间开关记录 (已确认 or 试机)
    List<StartLogBean> queryByOperateTimeBetweenEqualAndEquipmentId(@Param("minOperateTime") Date minOperateTime, @Param("maxOperateTime") Date maxOperateTime);

    // 查询 时间 之后的记录
    StartLogBean queryByEquipmentIdAndOperateTimeAfter(@Param("equipmentId") String equipmentId, @Param("minOperateTime") Date minOperateTime);

    // 查询 时间 之前的记录
    StartLogBean queryByEquipmentIdAndOperateTimeBefore(@Param("equipmentId") String equipmentId, @Param("maxOperateTime") Date maxOperateTime);

    // 公司驾驶舱
    Integer ratio();

    // 获取与设备泵站的id
    List<EqUnitDanageNameBo> getRelationship();
}
